﻿namespace WMS6.Web.Administration
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class EmailSettingQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnSearch;
        protected DropDownList ddlDescription;
        protected DropDownList ddlEmailSettingID;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected HtmlForm F1880;
        protected HtmlInputHidden hdnActionID;
        protected Label lblDescription;
        protected Label lblEmailSettingID;
        protected Label lblIsActive;
        protected Label lblRole;
        protected HtmlLink mycss;
        protected TextBox txtDescription;
        protected TextBox txtEmailSettingID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("EmailSettingList.aspx?action={0}&from=list", this.hdnActionID.Value.Trim()), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("EmailSettingList.aspx?action={0}", this.hdnActionID.Value.Trim()), false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlEmailSettingID, 0);
            base.InitQueryDDL(this.ddlDescription, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.InitDropDownLists();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    this.btnExport.Visible = false;
                }
            }
        }

        public string Description
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDescription.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDescription.Text.Trim(), this.ddlDescription.SelectedValue);
                }
                return "";
            }
        }

        public string EmailSettingID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEmailSettingID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtEmailSettingID.Text.Trim(), this.ddlEmailSettingID.SelectedValue);
                }
                return "";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsActive.SelectedValue, this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

